package com.huatai.bi.controller.bigScreen;

import com.huatai.bi.dto.bigScreen.BigScreenTypeDTO;
import com.huatai.bi.service.BigScreenTypeService;
import com.huatai.bi.vo.bigScreenVO.ScreenTypeTreeVO;
import com.huatai.bi.vo.bigScreenVO.ScreenTypeVO;
import com.huatai.common.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @BelongsProject: huatai-airport-cloud
 * @BelongsPackage: com.huatai.bi.controller
 * @Author: hecaiy
 * @CreateTime: 2024-06-18  14:59
 * @Description: TODO 大屏分类管理控制器
 * @Version: 1.0
 */
@RestController
@Api(value = "大屏分类管理(大屏)",tags = "大屏分类管理(大屏)")
@RequestMapping("/bigScreenType")
public class BigScreenTypeController {

    @Autowired
    private BigScreenTypeService bigScreenTypeService;

    @PostMapping("/save")
    @ApiOperation(value = "保存大屏分类")
    public R<Boolean> saveBigScreenType(@RequestBody BigScreenTypeDTO dto){
        return R.data(bigScreenTypeService.saveBigScreenType(dto));
    }

    @PostMapping("/update")
    @ApiOperation(value = "更新大屏分类")
    public R<Boolean> updateBigScreenType(@RequestBody BigScreenTypeDTO dto){
        return R.data(bigScreenTypeService.updateBigScreenType(dto));
    }

    @GetMapping("/delete/{id}")
    @ApiOperation(value = "删除大屏分类")
    public R<Boolean> deleteBigScreenType(@PathVariable("id") Long id){
        return R.data(bigScreenTypeService.deleteBigScreenType(id));
    }

    @GetMapping("/getListByTYpe/{type}")
    @ApiOperation(value = "根据类型获取大屏分类列表 类型取字典表中的big_screen_type 的 bigScreenCatalog ")
    public R<List<ScreenTypeVO>> getListByTYpe(@PathVariable("type") String type){
        return R.data(bigScreenTypeService.getListByTYpe(type));
    }

    @GetMapping("/getListByTypeTree/{type}")
    @ApiOperation(value = "根据类型获取大屏分类树")
    public R<List<ScreenTypeTreeVO>> getListByTypeTree(@PathVariable("type") String type){
        return R.data(bigScreenTypeService.getListByTypeTree(type));
    }
}
